{% extends 'base.html' %}

{% block title %}Excel导入导出管理{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="d-flex justify-content-between align-items-center mb-4">
                <h2><i class="fas fa-file-excel me-2"></i>Excel导入导出管理</h2>
            </div>

            <!-- 统计信息 -->
            <div class="row mb-4">
                <div class="col-md-6">
                    <div class="card text-center">
                        <div class="card-body">
                            <i class="fas fa-project-diagram fa-3x text-primary mb-3"></i>
                            <h4 class="card-title">项目总数</h4>
                            <h2 class="text-primary">{{ project_count }}</h2>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="card text-center">
                        <div class="card-body">
                            <i class="fas fa-tasks fa-3x text-success mb-3"></i>
                            <h4 class="card-title">子项目总数</h4>
                            <h2 class="text-success">{{ subproject_count }}</h2>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 导出功能 -->
            <div class="card mb-4">
                <div class="card-header">
                    <h5 class="mb-0">
                        <i class="fas fa-download me-2"></i>数据导出
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="card border-primary">
                                <div class="card-body text-center">
                                    <i class="fas fa-project-diagram fa-2x text-primary mb-3"></i>
                                    <h5 class="card-title">项目数据导出</h5>
                                    <p class="card-text">导出所有项目的详细信息，包括预算使用情况和统计数据。</p>
                                    <a href="{% url 'common:export_projects' %}" class="btn btn-primary">
                                        <i class="fas fa-download me-1"></i>导出项目数据
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card border-success">
                                <div class="card-body text-center">
                                    <i class="fas fa-tasks fa-2x text-success mb-3"></i>
                                    <h5 class="card-title">子项目数据导出</h5>
                                    <p class="card-text">导出所有子项目的详细信息，包括状态和预算使用情况。</p>
                                    <a href="{% url 'common:export_subprojects' %}" class="btn btn-success">
                                        <i class="fas fa-download me-1"></i>导出子项目数据
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 导入功能 -->
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">
                        <i class="fas fa-upload me-2"></i>数据导入
                    </h5>
                </div>
                <div class="card-body">
                    <div class="alert alert-info">
                        <i class="fas fa-info-circle me-2"></i>
                        <strong>导入说明：</strong>请先下载对应的导入模板，按照模板格式填写数据后再进行导入。
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="card border-warning">
                                <div class="card-body text-center">
                                    <i class="fas fa-project-diagram fa-2x text-warning mb-3"></i>
                                    <h5 class="card-title">项目数据导入</h5>
                                    <p class="card-text">批量导入项目数据，支持项目基本信息和预算设置。</p>
                                    <div class="btn-group-vertical w-100">
                                        <a href="{% url 'common:project_template' %}" class="btn btn-outline-warning mb-2">
                                            <i class="fas fa-file-download me-1"></i>下载项目模板
                                        </a>
                                        <a href="{% url 'common:import_projects_page' %}" class="btn btn-warning">
                                            <i class="fas fa-upload me-1"></i>导入项目数据
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card border-info">
                                <div class="card-body text-center">
                                    <i class="fas fa-tasks fa-2x text-info mb-3"></i>
                                    <h5 class="card-title">子项目数据导入</h5>
                                    <p class="card-text">批量导入子项目数据，自动关联到对应的父项目。</p>
                                    <div class="btn-group-vertical w-100">
                                        <a href="{% url 'common:subproject_template' %}" class="btn btn-outline-info mb-2">
                                            <i class="fas fa-file-download me-1"></i>下载子项目模板
                                        </a>
                                        <a href="{% url 'common:import_subprojects_page' %}" class="btn btn-info">
                                            <i class="fas fa-upload me-1"></i>导入子项目数据
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 使用说明 -->
            <div class="card mt-4">
                <div class="card-header">
                    <h5 class="mb-0">
                        <i class="fas fa-question-circle me-2"></i>使用说明
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <h6><strong>导出功能：</strong></h6>
                            <ul>
                                <li>点击对应的导出按钮即可下载Excel文件</li>
                                <li>导出的数据会根据您的权限进行过滤</li>
                                <li>文件名包含导出时间，便于管理</li>
                                <li>支持所有主流Excel软件打开</li>
                            </ul>
                        </div>
                        <div class="col-md-6">
                            <h6><strong>导入功能：</strong></h6>
                            <ul>
                                <li>必须先下载对应的导入模板</li>
                                <li>严格按照模板格式填写数据</li>
                                <li>带*号的字段为必填项</li>
                                <li>导入前会进行数据验证</li>
                                <li>支持批量导入，提高工作效率</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}